//
//  XS_BaseCollectionCell.swift
//  
//
//  Created by 韩云智 on 2021/10/5.
//

import UIKit
import RxCocoa
import RxSwift
import SnapKit

open class XS_BaseCollectionCell: UICollectionViewCell {
    open lazy var disposeBag = DisposeBag()
    /// 单元格重用时会重置
    open lazy var reuseDisposeBag = DisposeBag()
    //单元格重用时调用
    open override func prepareForReuse() {
        super.prepareForReuse()
        reuseDisposeBag = DisposeBag()
    }
    
    deinit {
#if DEBUG
        print("deinit: \(type(of: self))")
#endif
    }
    public override init(frame: CGRect) {
        super.init(frame: frame)
#if DEBUG
        print("init: \(type(of: self))")
#endif
        upView()
    }
    public required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    open func upView() {
        backgroundColor = Base_hanyz.backgroundColor
    }
}

open class XS_ImageCollectionCell: XS_BaseCollectionCell {
    public lazy var imgV = UIImageView()
    public override func upView() {
        contentView.addSubview(imgV)
        imgV.snp.makeConstraints {
            $0.edges.equalToSuperview()
        }
    }
}
